package chixing.day05;

public class LibraryTest {
    public static void main(String[] args) {
        Book book1 = new Book("001","三体","刘慈欣",true);
        Book book2 = new Book("002","活着","余华",true);
        Book book3 = new Book("003","理想国","柏拉图",true);
        Book book4 = new Book("004","杀死一只知更鸟","哈珀・李",true);
        Book book5 = new Book("005","西游记","吴承恩",true);
        Book book6 = new Book("006","边城","沈从文",true);
        Book book7 = new Book("007","追风筝的人","卡勒德・胡赛尼",true);
        Book book8 = new Book("008","我们仨","杨绛",true);
        Book book9 = new Book("009","人类简史：从动物到上帝","尤瓦尔・赫拉利",true);
        Book book10 = new Book("010","1984","乔治・奥威尔",true);
        //将书籍放入图书馆列表中
        Library library1 = new Library();
        library1.addBook(book1);
        library1.addBook(book2);
        library1.addBook(book3);
        library1.addBook(book4);
        library1.addBook(book5);
        library1.addBook(book6);
        library1.addBook(book7);
        library1.addBook(book8);
        library1.addBook(book9);
        library1.addBook(book10);
        library1.addBook(book10);

        //查看图书馆中所有书籍的数量 可借+不可借
        int n = library1.bookNumber();
        System.out.println("图书馆中一共有" + n + "本书");
        //打印图书馆中可借书籍
        library1.displayAvailableBooks();

        //创建一个用户，并开始借书
        User user1 = new User(1,"QQQ");
        //用户借阅book1，book2
        user1.borrowBook(book1);
        user1.borrowBook(book2);
        user1.borrowBook(book3);
        user1.borrowBook(book4);
        //打印当前用户借阅的书籍
        user1.listBorrowedBooks();

        //打印图书馆中可借书籍
        library1.displayAvailableBooks();

        //用户还书
        user1.returnBook("001");
        //查看用户的借阅列表，
        user1.listBorrowedBooks();
        //还书成功，查看图书馆中的可借书籍
        library1.displayAvailableBooks();
        System.out.println("------------------------------");
        //查找指定书籍
        Book b1=library1.getBookByISBN("001");
        System.out.println(b1);

//        //
//        user1.borrowBook(book9);
//        user1.listBorrowedBooks();


    }
}
